<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
  
    <div id="hello">
        <h2>{{getfullname2}}</h2>
        <h2>{{getfullname2}}</h2>
        <h2>{{getfullname2}}</h2>
        <h2>{{getfullname2}}</h2>
        <h2>{{getfullname()}}</h2>
        <h2>{{getfullname()}}</h2>
        <h2>{{getfullname()}}</h2>
        <h2>{{getfullname()}}</h2>
    </div>
  
    <script src="../vue.js"></script>
    <script>
        const vue01 = new Vue({
            el: '#hello',
            data: {
                firstname:'lin',
                lastname:'zejia',
            },
            methods: {
              getfullname:function(){
                //   method 调用一次执行一次
                  console.log('method done');
                  return this.firstname+''+this.lastname;
              } 
            },
            computed:{
                getfullname2:function(){
                    // <!-- computed只执行了一次 -->
                    console.log('computed done');
                    return this.firstname+''+this.lastname;
                }
            }

        })
    </script>
</body>

</html>